// eventManager.js
const listeners = {};

const addListener = (eventName, callback) => {
  if (!listeners[eventName]) {
    listeners[eventName] = [];
  }
  listeners[eventName].push(callback);
};

const emitEvent = (eventName, ...args) => {
  const eventListeners = listeners[eventName];
  if (eventListeners) {
    eventListeners.forEach((callback) => {
      callback(...args);
    });
  }
};

module.exports = {
  addListener,
  emitEvent,
};
